home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / Hack / MISC / NFSMON.ZIP / NFSMON.TXT
Encoding:
Text File  |  1996-04-27  |  34.2 KB  |  699 lines

  1.  
  2.  
  3. NFS Tracing By Passive Network Monitoring
  4.  
  5. Matt Blaze
  6.  
  7. Department of Computer Science Princeton University mab@cs.princeton.edu
  8.  
  9. ABSTRACT
  10.  
  11. Traces of filesystem activity have proven to be useful for a wide variety of
  12. purposes, rang ing from quantitative analysis of system behavior to
  13. trace-driven simulation of filesystem algo rithms. Such traces can be
  14. difficult to obtain, however, usually entailing modification of the
  15. filesystems to be monitored and runtime overhead for the period of the
  16. trace. Largely because of these difficulties, a surprisingly small number of
  17. filesystem traces have been conducted, and few sample workloads are
  18. available to filesystem researchers.
  19.  
  20. This paper describes a portable toolkit for deriving approximate traces of
  21. NFS [1] activity by non-intrusively monitoring the Ethernet traffic to and
  22. from the file server. The toolkit uses a promiscuous Ethernet listener
  23. interface (such as the Packetfilter[2]) to read and reconstruct NFS-related
  24. RPC packets intended for the server. It produces traces of the NFS activity
  25. as well as a plausible set of corresponding client system calls. The tool is
  26. currently in use at Princeton and other sites, and is available via
  27. anonymous ftp.
  28.  
  29. 1. Motivation
  30.  
  31. Traces of real workloads form an important part of virtually all analysis of
  32. computer system behavior, whether it is program hot spots, memory access
  33. patterns, or filesystem activity that is being studied. In the case of
  34. filesystem activity, obtaining useful traces is particularly challenging.
  35. Filesystem behavior can span long time periods, often making it necessary to
  36. collect huge traces over weeks or even months. Modification of the
  37. filesystem to collect trace data is often difficult, and may result in
  38. unacceptable runtime overhead. Distributed filesystems exa cerbate these
  39. difficulties, especially when the network is composed of a large number of
  40. heterogeneous machines. As a result of these difficulties, only a relatively
  41. small number of traces of Unix filesystem workloads have been conducted,
  42. primarily in computing research environments. [3], [4] and [5] are examples
  43. of such traces.
  44.  
  45. Since distributed filesystems work by transmitting their activity over a
  46. network, it would seem reasonable to obtain traces of such systems by
  47. placing a "tap" on the network and collecting trace data based on the
  48. network traffic. Ethernet[6] based networks lend themselves to this approach
  49. particularly well, since traffic is broadcast to all machines connected to a
  50. given subnetwork. A number of general-purpose network monitoring tools are
  51. avail able that "promiscuously" listen to the Ethernet to which they are
  52. connected; Sun's etherfind[7] is an example of such a tool. While these
  53. tools are useful for observing (and collecting statistics on) specific types
  54. of packets, the information they provide is at too low a level to be useful
  55. for building filesystem traces. Filesystem operations may span several
  56. packets, and may be meaningful only in the context of other, previous
  57. operations.
  58.  
  59. Some work has been done on characterizing the impact of NFS traffic on
  60. network load. In [8], for example, the results of a study are reported in
  61. which Ethernet traffic was monitored and statistics gathered on NFS
  62. activity. While useful for understanding traffic patterns and developing a
  63. queueing model of NFS loads, these previous stu dies do not use the network
  64. traffic to analyze the file access traffic patterns of the system, focusing
  65. instead on developing a statistical model of the individual packet sources,
  66. destinations, and types.
  67.  
  68. This paper describes a toolkit for collecting traces of NFS file access
  69. activity by monitoring Ethernet traffic. A "spy" machine with a promiscuous
  70. Ethernet interface is connected to the same network as the file server. Each
  71. NFS-related packet is analyzed and a trace is produced at an appropriate
  72. level of detail. The tool can record the low level NFS calls themselves or
  73. an approximation of the user-level system calls (open, close, etc.) that
  74. triggered the activity.
  75.  
  76. We partition the problem of deriving NFS activity from raw network traffic
  77. into two fairly distinct subprob lems: that of decoding the low-level NFS
  78. operations from the packets on the network, and that of translating these
  79. low-level commands back into user-level system calls. Hence, the toolkit
  80. consists of two basic parts, an "RPC decoder" (rpcspy) and the "NFS
  81. analyzer" (nfstrace). rpcspy communicates with a low-level network
  82. monitoring facility (such as Sun's NIT [9] or the Packetfilter [2]) to read
  83. and reconstruct the RPC transactions (call and reply) that make up each NFS
  84. command. nfstrace takes the output of rpcspy and reconstructs the sys tem
  85. calls that occurred as well as other interesting data it can derive about
  86. the structure of the filesystem, such as the mappings between NFS file
  87. handles and Unix file names. Since there is not a clean one-to-one mapping
  88. between system calls and lower-level NFS commands, nfstrace uses some simple
  89. heuristics to guess a reasonable approximation of what really occurred.
  90.  
  91. 1.1. A Spy's View of the NFS Protocols
  92.  
  93. It is well beyond the scope of this paper to describe the protocols used by
  94. NFS; for a detailed description of how NFS works, the reader is referred to
  95. [10], [11], and [12]. What follows is a very brief overview of how NFS
  96. activity translates into Ethernet packets.
  97.  
  98. An NFS network consists of servers, to which filesystems are physically
  99. connected, and clients, which per form operations on remote server
  100. filesystems as if the disks were locally connected. A particular machine can
  101. be a client or a server or both. Clients mount remote server filesystems in
  102. their local hierarchy just as they do local filesystems; from the user's
  103. perspective, files on NFS and local filesystems are (for the most part)
  104. indistinguishable, and can be manipulated with the usual filesystem calls.
  105.  
  106. The interface between client and server is defined in terms of 17 remote
  107. procedure call (RPC) operations. Remote files (and directories) are referred
  108. to by a file handle that uniquely identifies the file to the server. There
  109. are operations to read and write bytes of a file (read, write), obtain a
  110. file's attributes (getattr), obtain the contents of directories (lookup,
  111. readdir), create files (create), and so forth. While most of these
  112. operations are direct analogs of Unix system calls, notably absent are open
  113. and close operations; no client state information is maintained at the
  114. server, so there is no need to inform the server explicitly when a file is
  115. in use. Clients can maintain buffer cache entries for NFS files, but must
  116. verify that the blocks are still valid (by checking the last write time with
  117. the getattr operation) before using the cached data.
  118.  
  119. An RPC transaction consists of a call message (with arguments) from the
  120. client to the server and a reply mes sage (with return data) from the server
  121. to the client. NFS RPC calls are transmitted using the UDP/IP connection
  122. less unreliable datagram protocol[13]. The call message contains a unique
  123. transaction identifier which is included in the reply message to enable the
  124. client to match the reply with its call. The data in both messages is
  125. encoded in an "external data representation" (XDR), which provides a
  126. machine-independent standard for byte order, etc.
  127.  
  128. Note that the NFS server maintains no state information about its clients,
  129. and knows nothing about the context of each operation outside of the
  130. arguments to the operation itself.
  131.  
  132. 2. The rpcspy Program
  133.  
  134. rpcspy is the interface to the system-dependent Ethernet monitoring
  135. facility; it produces a trace of the RPC calls issued between a given set of
  136. clients and servers. At present, there are versions of rpcspy for a number
  137. of BSD-derived systems, including ULTRIX (with the Packetfilter[2]), SunOS
  138. (with NIT[9]), and the IBM RT running AOS (with the Stanford enet filter).
  139.  
  140. For each RPC transaction monitored, rpcspy produces an ASCII record
  141. containing a timestamp, the name of the server, the client, the length of
  142. time the command took to execute, the name of the RPC command executed, and
  143. the command- specific arguments and return data. Currently, rpcspy
  144. understands and can decode the 17 NFS RPC commands, and there are hooks to
  145. allow other RPC services (for example, NIS) to be added reasonably easily.
  146.  
  147. The output may be read directly or piped into another program (such as
  148. nfstrace) for further analysis; the for mat is designed to be reasonably
  149. friendly to both the human reader and other programs (such as nfstrace or
  150. awk).
  151.  
  152. Since each RPC transaction consists of two messages, a call and a reply,
  153. rpcspy waits until it receives both these components and emits a single
  154. record for the entire transaction. The basic output format is 8 vertical-bar
  155. separated fields:
  156.  
  157. timestamp | execution-time | server | client | command-name | arguments |
  158. reply-data
  159.  
  160. where timestamp is the time the reply message was received, execution-time
  161. is the time (in microseconds) that elapsed between the call and reply,
  162. server is the name (or IP address) of the server, client is the name (or IP
  163. address) of the client followed by the userid that issued the command,
  164. command-name is the name of the particular program invoked (read, write,
  165. getattr, etc.), and arguments and reply-data are the command dependent
  166. arguments and return values passed to and from the RPC program,
  167. respectively.
  168.  
  169. The exact format of the argument and reply data is dependent on the specific
  170. command issued and the level of detail the user wants logged. For example, a
  171. typical NFS command is recorded as follows:
  172.  
  173. 690529992.167140 | 11717 | paramount | merckx.321 | read |
  174. {"7b1f00000000083c", 0, 8192} | ok, 1871
  175.  
  176. In this example, uid 321 at client "merckx" issued an NFS read command to
  177. server "paramount". The reply was issued at (Unix time) 690529992.167140
  178. seconds; the call command occurred 11717 microseconds earlier. Three
  179. arguments are logged for the read call: the file handle from which to read
  180. (represented as a hexadecimal string), the offset from the beginning of the
  181. file, and the number of bytes to read. In this example, 8192 bytes are
  182. requested starting at the beginning (byte 0) of the file whose handle is
  183. "7b1f00000000083c". The command completed successfully (status "ok"), and
  184. 1871 bytes were returned. Of course, the reply message also included the
  185. 1871 bytes of data from the file, but that field of the reply is not logged
  186. by rpcspy.
  187.  
  188. rpcspy has a number of configuration options to control which hosts and RPC
  189. commands are traced, which call and reply fields are printed, which Ethernet
  190. interfaces are tapped, how long to wait for reply messages, how long to run,
  191. etc. While its primary function is to provide input for the nfstrace program
  192. (see Section 3), judi cious use of these options (as well as such programs
  193. as grep, awk, etc.) permit its use as a simple NFS diag nostic and
  194. performance monitoring tool. A few screens of output give a surprisingly
  195. informative snapshot of current NFS activity; we have identified quickly
  196. using the program several problems that were otherwise difficult to
  197. pinpoint. Similarly, a short awk script can provide a breakdown of the most
  198. active clients, servers, and hosts over a sampled time period.
  199.  
  200. 2.1. Implementation Issues
  201.  
  202. The basic function of rpcspy is to monitor the network, extract those
  203. packets containing NFS data, and print the data in a useful format. Since
  204. each RPC transaction consists of a call and a reply, rpcspy maintains a
  205. table of pending call packets that are removed and emitted when the matching
  206. reply arrives. In normal operation on a reasonably fast workstation, this
  207. rarely requires more than about two megabytes of memory, even on a busy net
  208. work with unusually slow file servers. Should a server go down, however, the
  209. queue of pending call messages (which are never matched with a reply) can
  210. quickly become a memory hog; the user can specify a maximum size the table
  211. is allowed to reach before these "orphaned" calls are searched out and
  212. reclaimed.
  213.  
  214. File handles pose special problems. While all NFS file handles are a fixed
  215. size, the number of significant bits varies from implementation to
  216. implementation; even within a vendor, two different releases of the same
  217. operating system might use a completely different internal handle format. In
  218. most Unix implementations, the handle contains a filesystem identifier and
  219. the inode number of the file; this is sometimes augmented by additional
  220. information, such as a version number. Since programs using rpcspy output
  221. generally will use the handle as a unique file identifier, it is important
  222. that there not appear to be more than one handle for the same file.
  223. Unfortunately, it is not sufficient to simply consider the handle as a
  224. bitstring of the maximum handle size, since many operating systems do not
  225. zero out the unused extra bits before assigning the handle. Fortunately,
  226. most servers are at least consistent in the sizes of the handles they
  227. assign. rpcspy allows the user to specify (on the command line or in a
  228. startup file) the handle size for each host to be monitored. The handles
  229. from that server are emitted as hexadecimal strings truncated at that
  230. length. If no size is specified, a guess is made based on a few common
  231. formats of a reasonable size.
  232.  
  233. It is usually desirable to emit IP addresses of clients and servers as their
  234. symbolic host names. An early ver sion of the software simply did a
  235. nameserver lookup each time this was necessary; this quickly flooded the
  236. network with a nameserver request for each NFS transaction. The current
  237. version maintains a cache of host names; this requires a only a modest
  238. amount of memory for typical networks of less than a few hundred hosts. For
  239. very large networks or those where NFS service is provided to a large number
  240. of remote hosts, this could still be a potential problem, but as a last
  241. resort remote name resolution could be disabled or rpcspy configured to not
  242. translate IP addresses.
  243.  
  244. UDP/IP datagrams may be fragmented among several packets if the datagram is
  245. larger than the maximum size of a single Ethernet frame. rpcspy looks only
  246. at the first fragment; in practice, fragmentation occurs only for the data
  247. fields of NFS read and write transactions, which are ignored anyway.
  248.  
  249. 3. nfstrace: The Filesystem Tracing Package
  250.  
  251. Although rpcspy provides a trace of the low-level NFS commands, it is not,
  252. in and of itself, sufficient for obtaining useful filesystem traces. The
  253. low-level commands do not by themselves reveal user-level activity. Furth
  254. ermore, the volume of data that would need to be recorded is potentially
  255. enormous, on the order of megabytes per hour. More useful would be an
  256. abstraction of the user-level system calls underlying the NFS activity.
  257.  
  258. nfstrace is a filter for rpcspy that produces a log of a plausible set of
  259. user level filesystem commands that could have triggered the monitored
  260. activity. A record is produced each time a file is opened, giving a summary
  261. of what occurred. This summary is detailed enough for analysis or for use as
  262. input to a filesystem simulator.
  263.  
  264. The output format of nfstrace consists of 7 fields:
  265.  
  266. timestamp | command-time | direction | file-id | client | transferred | size
  267.  
  268. where timestamp is the time the open occurred, command-time is the length of
  269. time between open and close, direc tion is either read or write (mkdir and
  270. readdir count as write and read, respectively). file-id identifies the
  271. server and the file handle, client is the client and user that performed the
  272. open, transferred is the number of bytes of the file actually read or
  273. written (cache hits have a 0 in this field), and size is the size of the
  274. file (in bytes).
  275.  
  276. An example record might be as follows:
  277.  
  278. 690691919.593442 | 17734 | read | basso:7b1f00000000400f | frejus.321 | 0 |
  279. 24576
  280.  
  281. Here, userid 321 at client frejus read file 7b1f00000000400f on server
  282. basso. The file is 24576 bytes long and was able to be read from the client
  283. cache. The command started at Unix time 690691919.593442 and took 17734
  284. microseconds at the server to execute.
  285.  
  286. Since it is sometimes useful to know the name corresponding to the handle
  287. and the mode information for each file, nfstrace optionally produces a map
  288. of file handles to file names and modes. When enough information (from
  289. lookup and readdir commands) is received, new names are added. Names can
  290. change over time (as files are deleted and renamed), so the times each
  291. mapping can be considered valid is recorded as well. The mapping infor
  292. mation may not always be complete, however, depending on how much activity
  293. has already been observed. Also, hard links can confuse the name mapping,
  294. and it is not always possible to determine which of several possible names a
  295. file was opened under.
  296.  
  297. What nfstrace produces is only an approximation of the underlying user
  298. activity. Since there are no NFS open or close commands, the program must
  299. guess when these system calls occur. It does this by taking advantage of the
  300. observation that NFS is fairly consistent in what it does when a file is
  301. opened. If the file is in the local buffer cache, a getattr call is made on
  302. the file to verify that it has not changed since the file was cached.
  303. Otherwise, the actual bytes of the file are fetched as they are read by the
  304. user. (It is possible that part of the file is in the cache and part is not,
  305. in which case the getattr is performed and only the missing pieces are
  306. fetched. This occurs most often when a demand-paged executable is loaded).
  307. nfstrace assumes that any sequence of NFS read calls on the same file issued
  308. by the same user at the same client is part of a single open for read. The
  309. close is assumed to have taken place when the last read in the sequence
  310. completes. The end of a read sequence is detected when the same client reads
  311. the beginning of the file again or when a timeout with no reading has
  312. elapsed. Writes are handled in a similar manner.
  313.  
  314. Reads that are entirely from the client cache are a bit harder; not every
  315. getattr command is caused by a cache read, and a few cache reads take place
  316. without a getattr. A user level stat system call can sometimes trigger a
  317. getattr, as can an ls -l command. Fortunately, the attribute caching used by
  318. most implementations of NFS seems to eliminate many of these extraneous
  319. getattrs, and ls commands appear to trigger a lookup command most of the
  320. time. nfstrace assumes that a getattr on any file that the client has read
  321. within the past few hours represents a cache read, otherwise it is ignored.
  322. This simple heuristic seems to be fairly accurate in practice. Note also
  323. that a getattr might not be performed if a read occurs very soon after the
  324. last read, but the time threshold is generally short enough that this is
  325. rarely a problem. Still, the cached reads that nfstrace reports are, at
  326. best, an estimate (generally erring on the side of over-reporting). There is
  327. no way to determine the number of bytes actually read for cache hits.
  328.  
  329. The output of nfstrace is necessarily produced out of chronological order,
  330. but may be sorted easily by a post-processor.
  331.  
  332. nfstrace has a host of options to control the level of detail of the trace,
  333. the lengths of the timeouts, and so on. To facilitate the production of very
  334. long traces, the output can be flushed and checkpointed at a specified inter
  335. val, and can be automatically compressed.
  336.  
  337. 4. Using rpcspy and nfstrace for Filesystem Tracing
  338.  
  339. Clearly, nfstrace is not suitable for producing highly accurate traces;
  340. cache hits are only estimated, the timing information is imprecise, and data
  341. from lost (and duplicated) network packets are not accounted for. When such
  342. a highly accurate trace is required, other approaches, such as modification
  343. of the client and server kernels, must be employed.
  344.  
  345. The main virtue of the passive-monitoring approach lies in its simplicity.
  346. In [5], Baker, et al, describe a trace of a distributed filesystem which
  347. involved low-level modification of several different operating system
  348. kernels. In contrast, our entire filesystem trace package consists of less
  349. than 5000 lines of code written by a single programmer in a few weeks,
  350. involves no kernel modifications, and can be installed to monitor multiple
  351. heterogeneous servers and clients with no knowledge of even what operating
  352. systems they are running.
  353.  
  354. The most important parameter affecting the accuracy of the traces is the
  355. ability of the machine on which rpcspy is running to keep up with the
  356. network traffic. Although most modern RISC workstations with reasonable
  357. Ethernet interfaces are able to keep up with typical network loads, it is
  358. important to determine how much informa tion was lost due to packet buffer
  359. overruns before relying upon the trace data. It is also important that the
  360. trace be, indeed, non-intrusive. It quickly became obvious, for example,
  361. that logging the traffic to an NFS filesystem can be problematic.
  362.  
  363. Another parameter affecting the usefulness of the traces is the validity of
  364. the heuristics used to translate from RPC calls into user-level system
  365. calls. To test this, a shell script was written that performed ls -l, touch,
  366. cp and wc commands randomly in a small directory hierarchy, keeping a record
  367. of which files were touched and read and at what time. After several hours,
  368. nfstrace was able to detect 100% of the writes, 100% of the uncached reads,
  369. and 99.4% of the cached reads. Cached reads were over-reported by 11%, even
  370. though ls com mands (which cause the "phantom" reads) made up 50% of the
  371. test activity. While this test provides encouraging evidence of the accuracy
  372. of the traces, it is not by itself conclusive, since the particular workload
  373. being monitored may fool nfstrace in unanticipated ways.
  374.  
  375. As in any research where data are collected about the behavior of human
  376. subjects, the privacy of the individu als observed is a concern. Although
  377. the contents of files are not logged by the toolkit, it is still possible to
  378. learn something about individual users from examining what files they read
  379. and write. At a minimum, the users of a mon itored system should be informed
  380. of the nature of the trace and the uses to which it will be put. In some
  381. cases, it may be necessary to disable the name translation from nfstrace
  382. when the data are being provided to others. Commercial sites where filenames
  383. might reveal something about proprietary projects can be particularly
  384. sensitive to such concerns.
  385.  
  386. 5. A Trace of Filesystem Activity in the Princeton C.S. Department
  387.  
  388. A previous paper[14] analyzed a five-day long trace of filesystem activity
  389. conducted on 112 research worksta tions at DEC-SRC. The paper identified a
  390. number of file access properties that affect filesystem caching perfor
  391. mance; it is difficult, however, to know whether these properties were
  392. unique artifacts of that particular environment or are more generally
  393. applicable. To help answer that question, it is necessary to look at similar
  394. traces from other computing environments.
  395.  
  396. It was relatively easy to use rpcspy and nfstrace to conduct a week long
  397. trace of filesystem activity in the Princeton University Computer Science
  398. Department. The departmental computing facility serves a community of
  399. approximately 250 users, of which about 65% are researchers (faculty,
  400. graduate students, undergraduate researchers, postdoctoral staff, etc), 5%
  401. office staff, 2% systems staff, and the rest guests and other "external"
  402. users. About 115 of the users work full-time in the building and use the
  403. system heavily for electronic mail, netnews, and other such communication
  404. services as well as other computer science research oriented tasks (editing,
  405. compiling, and executing programs, formatting documents, etc).
  406.  
  407. The computing facility consists of a central Auspex file server (fs) (to
  408. which users do not ordinarily log in directly), four DEC 5000/200s (elan,
  409. hart, atomic and dynamic) used as shared cycle servers, and an assortment of
  410. dedicated workstations (NeXT machines, Sun workstations, IBM-RTs, Iris
  411. workstations, etc.) in indi vidual offices and laboratories. Most users log
  412. in to one of the four cycle servers via X window terminals located in
  413. offices; the terminals are divided evenly among the four servers. There are
  414. a number of Ethernets throughout the building. The central file server is
  415. connected to a "machine room network" to which no user terminals are
  416. directly connected; traffic to the file server from outside the machine room
  417. is gatewayed via a Cisco router. Each of the four cycle servers has a local
  418. /, /bin and /tmp filesystem; other filesystems, including /usr, /usr/local,
  419. and users' home directories are NFS mounted from fs. Mail sent from local
  420. machines is delivered locally to the (shared) fs:/usr/spool/mail; mail from
  421. outside is delivered directly on fs.
  422.  
  423. The trace was conducted by connecting a dedicated DEC 5000/200 with a local
  424. disk to the machine room net work. This network carries NFS traffic for all
  425. home directory access and access to all non-local cycle-server files
  426. (including the most of the actively-used programs). On a typical weekday,
  427. about 8 million packets are transmitted over this network. nfstrace was
  428. configured to record opens for read and write (but not directory accesses or
  429. individual reads or writes). After one week (wednesday to wednesday),
  430. 342,530 opens for read and 125,542 opens for write were recorded, occupying
  431. 8 MB of (compressed) disk space. Most of this traffic was from the four
  432. cycle servers.
  433.  
  434. No attempt was made to "normalize" the workload during the trace period.
  435. Although users were notified that file accesses were being recorded, and
  436. provided an opportunity to ask to be excluded from the data collection, most
  437. users seemed to simply continue with their normal work. Similarly, no
  438. correction is made for any anomalous user activity that may have occurred
  439. during the trace.
  440.  
  441. 5.1. The Workload Over Time
  442.  
  443. Intuitively, the volume of traffic can be expected to vary with the time of
  444. day. Figure 1 shows the number of reads and writes per hour over the seven
  445. days of the trace; in particular, the volume of write traffic seems to
  446. mirror the general level of departmental activity fairly closely.
  447.  
  448. An important metric of NFS performance is the client buffer cache hit rate.
  449. Each of the four cycle servers allocates approximately 6MB of memory for the
  450. buffer cache. The (estimated) aggregate hit rate (percentage of reads served
  451. by client caches) as seen at the file server was surprisingly low: 22.2%
  452. over the entire week. In any given hour, the hit rate never exceeded 40%.
  453. Figure 2 plots (actual) server reads and (estimated) cache hits per hour
  454. over the trace week; observe that the hit rate is at its worst during
  455. periods of the heaviest read activity.
  456.  
  457. Past studies have predicted much higher hit rates than the aggregate
  458. observed here. It is probable that since most of the traffic is generated by
  459. the shared cycle servers, the low hit rate can be attributed to the large
  460. number of users competing for cache space. In fact, the hit rate was
  461. observed to be much higher on the single-user worksta tions monitored in the
  462. study, averaging above 52% overall. This suggests, somewhat
  463. counter-intuitively, that if more computers were added to the network (such
  464. that each user had a private workstation), the server load would decrease
  465. considerably. Figure 3 shows the actual cache misses and estimated cache
  466. hits for a typical private works tation in the study.
  467.  
  468. Thu 00:00  Thu 06:00  Thu 12:00  Thu 18:00  Fri 00:00  Fri 06:00  Fri 12:00
  469. Fri 18:00 Sat 00:00 Sat 06:00 Sat 12:00 Sat 18:00 Sun 00:00 Sun 06:00 Sun
  470. 12:00 Sun 18:00 Mon 00:00 Mon 06:00 Mon 12:00 Mon 18:00 Tue 00:00 Tue 06:00
  471. Tue 12:00 Tue 18:00 Wed 00:00 Wed 06:00 Wed 12:00 Wed 18:00
  472.  
  473. 1000
  474.  
  475. 2000
  476.  
  477. 3000
  478.  
  479. 4000
  480.  
  481. 5000
  482.  
  483. 6000
  484.  
  485. Reads/Writes per hour
  486.  
  487. Writes
  488.  
  489. Reads (all)
  490.  
  491. Figure 1 - Read and Write Traffic Over Time
  492.  
  493. 5.2. File Sharing
  494.  
  495. One property observed in the DEC-SRC trace is the tendency of files that are
  496. used by multiple workstations to make up a significant proportion of read
  497. traffic but a very small proportion of write traffic. This has important
  498. implications for a caching strategy, since, when it is true, files that are
  499. cached at many places very rarely need to be invalidated. Although the
  500. Princeton computing facility does not have a single workstation per user, a
  501. similar metric is the degree to which files read by more than one user are
  502. read and written. In this respect, the Princeton trace is very similar to
  503. the DEC-SRC trace. Files read by more than one user make up more than 60% of
  504. read traffic, but less than 2% of write traffic. Files shared by more than
  505. ten users make up less than .2% of write traffic but still more than 30% of
  506. read traffic. Figure 3 plots the number of users who have previously read
  507. each file against the number of reads and writes.
  508.  
  509. 5.3. File "Entropy"
  510.  
  511. Files in the DEC-SRC trace demonstrated a strong tendency to "become"
  512. read-only as they were read more and more often. That is, the probability
  513. that the next operation on a given file will overwrite the file drops off
  514. shar ply in proportion to the number of times it has been read in the past.
  515. Like the sharing property, this has implications for a caching strategy,
  516. since the probability that cached data is valid influences the choice of a
  517. validation scheme. Again, we find this property to be very strong in the
  518. Princeton trace. For any file access in the trace, the probability that it
  519. is a write is about 27%. If the file has already been read at least once
  520. since it was last written to, the write probability drops to 10%. Once the
  521. file has been read at least five times, the write probability drops below
  522. 1%. Fig ure 4 plots the observed write probability against the number of
  523. reads since the last write.
  524.  
  525. Thu 00:00  Thu 06:00  Thu 12:00  Thu 18:00  Fri 00:00  Fri 06:00  Fri 12:00
  526. Fri 18:00 Sat 00:00 Sat 06:00 Sat 12:00 Sat 18:00 Sun 00:00 Sun 06:00 Sun
  527. 12:00 Sun 18:00 Mon 00:00 Mon 06:00 Mon 12:00 Mon 18:00 Tue 00:00 Tue 06:00
  528. Tue 12:00 Tue 18:00 Wed 00:00 Wed 06:00 Wed 12:00 Wed 18:00
  529.  
  530. 1000
  531.  
  532. 2000
  533.  
  534. 3000
  535.  
  536. 4000
  537.  
  538. 5000
  539.  
  540. Total reads per hour
  541.  
  542. Cache Hits (estimated)
  543.  
  544. Cache Misses (actual)
  545.  
  546. Figure 2 - Cache Hits and Misses Over Time
  547.  
  548. 6. Conclusions
  549.  
  550. Although filesystem traces are a useful tool for the analysis of current and
  551. proposed systems, the difficulty of collecting meaningful trace data makes
  552. such traces difficult to obtain. The performance degradation introduced by
  553. the trace software and the volume of raw data generated makes traces over
  554. long time periods and outside of comput ing research facilities particularly
  555. hard to conduct.
  556.  
  557. Although not as accurate as direct, kernel-based tracing, a passive network
  558. monitor such as the one described in this paper can permit tracing of
  559. distributed systems relatively easily. The ability to limit the data
  560. collected to a high-level log of only the data required can make it
  561. practical to conduct traces over several months. Such a long term trace is
  562. presently being conducted at Princeton as part of the author's research on
  563. filesystem caching. The non-intrusive nature of the data collection makes
  564. traces possible at facilities where kernel modification is impracti cal or
  565. unacceptable.
  566.  
  567. It is the author's hope that other sites (particularly those not doing
  568. computing research) will make use of this toolkit and will make the traces
  569. available to filesystem researchers.
  570.  
  571. 7. Availability
  572.  
  573. The toolkit, consisting of rpcspy, nfstrace, and several support scripts,
  574. currently runs under several BSD-derived platforms, including ULTRIX 4.x,
  575. SunOS 4.x, and IBM-RT/AOS. It is available for anonymous ftp over the
  576. Internet from samadams.princeton.edu, in the compressed tar file
  577. nfstrace/nfstrace.tar.Z.
  578.  
  579. Thu 00:00  Thu 06:00  Thu 12:00  Thu 18:00  Fri 00:00  Fri 06:00  Fri 12:00
  580. Fri 18:00 Sat 00:00 Sat 06:00 Sat 12:00 Sat 18:00 Sun 00:00 Sun 06:00 Sun
  581. 12:00 Sun 18:00 Mon 00:00 Mon 06:00 Mon 12:00 Mon 18:00 Tue 00:00 Tue 06:00
  582. Tue 12:00 Tue 18:00 Wed 00:00 Wed 06:00 Wed 12:00 Wed 18:00 0
  583.  
  584. 100
  585.  
  586. 200
  587.  
  588. 300
  589.  
  590. Reads per hour
  591.  
  592. Cache Hits (estimated)
  593.  
  594. Cache Misses (actual)
  595.  
  596. Figure 3 - Cache Hits and Misses Over Time - Private Workstation
  597.  
  598. 0 5 10 15 20
  599.  
  600. n (readers)
  601.  
  602. 0
  603.  
  604. 20
  605.  
  606. 40
  607.  
  608. 60
  609.  
  610. 80
  611.  
  612. 100
  613.  
  614. % of Reads and Writes used by > n users
  615.  
  616. Reads
  617.  
  618. Writes
  619.  
  620. Figure 4 - Degree of Sharing for Reads and Writes
  621.  
  622. 0 5 10 15 20
  623.  
  624. Reads Since Last Write
  625.  
  626. 0.0
  627.  
  628. 0.1
  629.  
  630. 0.2
  631.  
  632. P(next operation is write)
  633.  
  634. Figure 5 - Probability of Write Given >= n Previous Reads
  635.  
  636. 8. Acknowledgments
  637.  
  638. The author would like to gratefully acknowledge Jim Roberts and Steve Beck
  639. for their help in getting the trace machine up and running, Rafael Alonso
  640. for his helpful comments and direction, and the members of the pro gram
  641. committee for their valuable suggestions. Jim Plank deserves special thanks
  642. for writing jgraph, the software which produced the figures in this paper.
  643.  
  644. 9. References
  645.  
  646. [1] Sandberg, R., Goldberg, D., Kleiman, S., Walsh, D., & Lyon, B. "Design
  647. and Implementation of the Sun Net work File System." Proc. USENIX, Summer,
  648. 1985.
  649.  
  650. [2] Mogul, J., Rashid, R., & Accetta, M. "The Packet Filter: An Efficient
  651. Mechanism for User-Level Network Code." Proc. 11th ACM Symp. on Operating
  652. Systems Principles, 1987.
  653.  
  654. [3] Ousterhout J., et al. "A Trace-Driven Analysis of the Unix 4.2 BSD File
  655. System." Proc. 10th ACM Symp. on Operating Systems Principles, 1985.
  656.  
  657. [4] Floyd, R. "Short-Term File Reference Patterns in a UNIX Environment,"
  658. TR-177 Dept. Comp. Sci, U. of Rochester, 1986.
  659.  
  660. [5] Baker, M. et al. "Measurements of a Distributed File System," Proc. 13th
  661. ACM Symp. on Operating Systems Principles, 1991.
  662.  
  663. [6] Metcalfe, R. & Boggs, D. "Ethernet: Distributed Packet Switching for
  664. Local Computer Networks," CACM July, 1976.
  665.  
  666. [7] "Etherfind(8) Manual Page," SunOS Reference Manual, Sun Microsystems,
  667. 1988.
  668.  
  669. [8] Gusella, R. "Analysis of Diskless Workstation Traffic on an Ethernet,"
  670. TR-UCB/CSD-87/379, University Of California, Berkeley, 1987.
  671.  
  672. [9] "NIT(4) Manual Page," SunOS Reference Manual, Sun Microsystems, 1988.
  673.  
  674. [10] "XDR Protocol Specification," Networking on the Sun Workstation, Sun
  675. Microsystems, 1986.
  676.  
  677. [11] "RPC Protocol Specification," Networking on the Sun Workstation, Sun
  678. Microsystems, 1986.
  679.  
  680. [12] "NFS Protocol Specification," Networking on the Sun Workstation, Sun
  681. Microsystems, 1986.
  682.  
  683. [13] Postel, J. "User Datagram Protocol," RFC 768, Network Information
  684. Center, 1980.
  685.  
  686. [14] Blaze, M., and Alonso, R., "Long-Term Caching Strategies for Very Large
  687. Distributed File Systems," Proc. Summer 1991 USENIX, 1991.
  688.  
  689. Matt Blaze is a Ph.D. candidate in Computer Science at Princeton University,
  690. where he expects to receive his degree in the Spring of 1992. His research
  691. interests include distributed systems, operating systems, databases, and
  692. programming environments. His current research focuses on caching in very
  693. large distributed filesys tems. In 1988 he received an M.S. in Computer
  694. Science from Columbia University and in 1986 a B.S. from Hunter College. He
  695. can be reached via email at mab@cs.princeton.edu or via US mail at Dept. of
  696. Computer Science, Princeton University, 35 Olden Street, Princeton NJ
  697. 08544.
  698.  
  699.